<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head lang="zh-CN">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="js/jquery-1.7.2.min.js"></script>
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
      <script src="js/jquery.validate.min.js"></script>
    <script src="js/messages_zh.js"></script>
<title>Insert title here</title>
<style type="text/css">
	.inp1{
		width: 200px;
		background-color: #fff;
							    background-image: none;
							    border: 1px solid #ccc;
							    border-radius: 4px;
							    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
							    color: #555;
							    font-size: 14px;
							    height: 34px;
							    line-height: 1.42857;
							    padding: 6px 12px;
	}
</style>
</head>
<script type="text/javascript">
	//修改成功时
	$(function(){
		$("#updateinfo").click(function(){
			var oldpsw = $("#oldpassword").val();
			var newpsw1 = $("#newpassword1").val();
			var newpsw2 = $("#newpassword2").val();
			var newaddr = $("#newaddress").val();
			var newphone = $("#newphone").val();
			$.ajax({
				url:'updateuserinfo',
				type:'post',
				data:{
					"oldpassword":oldpsw,
					"newpassword1":newpsw1,
					"newpassword2":newpsw2,
					"newaddress":newaddr,
					"newphone":newphone,
				},
				datatype:'json',
				success:function(data){
					if(data=="1"){
						
				
					alert("修改信息成功");
					location.href = "login.jsp";
					}
				},
				err:function(data){
					alert("修改失败");
					lacation.href = "updateuserinfo";
				}				
			})
		});
	});
</script>
<body>
	<div style="height: 100%;width: 100% ;">
		<!-- 导航栏 -->
		<div style="background-color:#BFBDC2" class="navbar navbar-default navbar-fixed-top" role="navigation">
			<div class="container-fluid">
		    	<div class="navbar-header">
		      	<a class="navbar-brand" href="enterusermain"><img alt="加载失败" src="img/elmlogo.png" style="width:60px;heigth:28px"/></a>  <!-- logo标题 -->
		    	</div>
		
		    	<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
			  <ul class="nav navbar-nav navbar-right" style="margin-right: 50px">
			        	<li class="dropdown">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown"><img alt="" src="img/order.png">我的订单<span class="caret"></span></a>
			        		<ul class="dropdown-menu" role="menu">
			        			<li><a href="pastuserorder">过往订单</a></li>
					            <li class="divider"></li>
					            <li><a href="currentuserorder">当前订单</a></li>
			        		</ul>
			        	</li>

			        	<li><a href="favorite"><img alt="" src="img/favorite.png" style="90%">我的收藏</a></li>
			        	<li><a href="shoppingcar"><img alt="" src="img/shoppingcar.png">我的购物车</a></li>
			        	<li><a href="updateuserinfo">修改信息</a></li>
			        	<li><a href="#">退出登录</a></li>
			      	</ul>
		    	</div><!-- /.navbar-collapse -->
		  	</div><!-- /.container-fluid -->
		</div>
	
	<div class="container" style="margin-top: 100px;">
	<div class="col-md-12">
		<div class="col-md-2"></div>
		<div class="col-md-8">
			<form role="form" method = "post">
				<div class="form-group">
			    	<label for="exampleInputEmail1">原密码</label>
			    	<input type="password" class="form-control" id="oldpassword" placeholder="oldpassword">
				</div>
			  	<div class="form-group">
			    	<label for="exampleInputPassword1">新密码</label>
			    	<input type="password" class="form-control" id="newpassword1" placeholder="newPassword">
			  	</div>
			  	<div class="form-group">
			    	<label for="exampleInputPassword1">确认新密码</label>
			    	<input type="password" class="form-control" id="newpassword2" placeholder="newPassword">
			  	</div>
			  	<div class="form-group">
			    	<label for="exampleInputPassword1">地址</label>
			    	<input type="text" class="form-control" id="newaddress" value="${currentUser.useraddr}">
			  	</div>
			  	<div class="form-group">
			    	<label for="exampleInputPassword1">联系电话</label>
			    	<input type="text" class="form-control" id="newphone" value="${currentUser.userphone}">
			  	</div>
			  	<button type="button" class="btn btn-default" id = "updateinfo">确认修改</button>
			</form>
		</div>
</div>
</div>
	</div>
</body>
</html>